package com.ce.pms.log4ce;

	public  class CustomerRecord{
		//		个人
		private static final String HOUSE_NUMBER_TEXT = "房号:";
		private static final String OWNER_NAME_TEXT = "姓名：";
		private static final String CERTIFICATE_NAME_TEXT = "证件类型：";
		private static final String CERTIFICATE_NO_TEXT = "证件号码：";
		private static final String TELEPHONE_TEXT = " 联系电话：";
		private String houseNumber;
		private String ownerName;
		private String certificateName;
		private String certificateNo;
		private String telephone;

		//组织
		private static final String ORGANIZATION_NAME_TEXT = "单位名称：";
		private static final String ORGANIZATION_ADDRESS_TEXT = "单位地址：";
		private static final String ORGANIZATION_CONTACT_PERSON_TEXT = "联系人：";
		private static final String ORGANIZATION_TELEPHONE_TEXT = "联系电话：";
		private static final String ORGANIZATION_ZIPCODE_TEXT = "邮政编码：";

		private static final String INNER_SPLIT_TEXT = ", ";
		private static final String LEFT_BRACKET_TEXT = "{";
		private static final String RIGHT_BRACKET_TEXT = "}";

		private static final String CHANGE_TO_TEXT = " --〉";
		public static final String OUTER_SPLIT_TEXT = ";";
		//是否为组织
		private boolean isOrganization;



		private String orgName;
		private String orgAddress;
		private String orgContactPerson;
		private String orgTelephone;
		private String orgZipcode;

		public static String displayChangedInfo(CustomerRecord source, CustomerRecord target){
			StringBuffer sb = new StringBuffer();
			if(source.isOrganization() && target.isOrganization())
			{
				sb.append(HOUSE_NUMBER_TEXT).append(source.getHouseNumber()).append(CHANGE_TO_TEXT).append(target.getHouseNumber()).append(INNER_SPLIT_TEXT);
				sb.append(ORGANIZATION_NAME_TEXT).append(source.getOrgName()).append(CHANGE_TO_TEXT).append(target.getOrgName()).append(INNER_SPLIT_TEXT);
				sb.append(ORGANIZATION_ADDRESS_TEXT).append(source.getOrgAddress()).append(CHANGE_TO_TEXT).append(target.getOrgAddress()).append(INNER_SPLIT_TEXT);
				sb.append(ORGANIZATION_CONTACT_PERSON_TEXT).append(source.getOrgContactPerson()).append(CHANGE_TO_TEXT).append(target.getOrgContactPerson()).append(INNER_SPLIT_TEXT);
				sb.append(ORGANIZATION_TELEPHONE_TEXT).append(source.getOrgTelephone()).append(CHANGE_TO_TEXT).append(target.getOrgTelephone()).append(INNER_SPLIT_TEXT);
				sb.append(ORGANIZATION_ZIPCODE_TEXT).append(source.getOrgZipcode()).append(CHANGE_TO_TEXT).append(target.getOrgZipcode());
			}else if(!source.isOrganization() && !target.isOrganization()){
				sb.append(HOUSE_NUMBER_TEXT).append(source.getHouseNumber()).append(CHANGE_TO_TEXT).append(target.getHouseNumber()).append(INNER_SPLIT_TEXT);
				sb.append(OWNER_NAME_TEXT).append(source.getOwnerName()).append(CHANGE_TO_TEXT).append(target.getOwnerName()).append(INNER_SPLIT_TEXT);
				sb.append(CERTIFICATE_NAME_TEXT).append(source.getCertificateName()).append(CHANGE_TO_TEXT).append(target.getCertificateName()).append(INNER_SPLIT_TEXT);
				sb.append(CERTIFICATE_NO_TEXT).append(source.getCertificateNo()).append(CHANGE_TO_TEXT).append(target.getCertificateNo()).append(INNER_SPLIT_TEXT);
				sb.append(TELEPHONE_TEXT).append(source.getTelephone()).append(CHANGE_TO_TEXT).append(target.getTelephone());
			}
			return sb.toString();
		}

		@Override
		public String toString()
		{
			StringBuffer sb = new StringBuffer();
			sb.append(LEFT_BRACKET_TEXT);
			if(isOrganization)
			{
				sb.append(HOUSE_NUMBER_TEXT).append(houseNumber).append(INNER_SPLIT_TEXT);
				sb.append(ORGANIZATION_NAME_TEXT).append(orgName).append(INNER_SPLIT_TEXT);
				sb.append(ORGANIZATION_ADDRESS_TEXT).append(orgAddress).append(INNER_SPLIT_TEXT);
				sb.append(ORGANIZATION_CONTACT_PERSON_TEXT).append(orgContactPerson).append(INNER_SPLIT_TEXT);
				sb.append(ORGANIZATION_TELEPHONE_TEXT).append(orgTelephone).append(INNER_SPLIT_TEXT);
				sb.append(ORGANIZATION_ZIPCODE_TEXT).append(orgZipcode);
			}else {
				sb.append(HOUSE_NUMBER_TEXT).append(houseNumber).append(INNER_SPLIT_TEXT);
				sb.append(OWNER_NAME_TEXT).append(ownerName).append(INNER_SPLIT_TEXT);
				sb.append(CERTIFICATE_NAME_TEXT).append(certificateName).append(INNER_SPLIT_TEXT);
				sb.append(CERTIFICATE_NO_TEXT).append(certificateNo).append(INNER_SPLIT_TEXT);
				sb.append(TELEPHONE_TEXT).append(telephone);
			}
			sb.append(RIGHT_BRACKET_TEXT);
			return sb.toString();
		}

		public String getHouseNumber()
		{
			return houseNumber == null ?"":houseNumber;
		}
		public String getOwnerName()
		{
			return ownerName == null?"":ownerName;
		}
		public String getCertificateName()
		{
			return certificateName == null?"":certificateName;
		}
		public String getCertificateNo()
		{
			return certificateNo == null?"":certificateNo;
		}
		public String getTelephone()
		{
			return telephone == null?"":telephone;
		}
		public void setHouseNumber(String houseNumber)
		{
			this.houseNumber = houseNumber;
		}
		public void setOwnerName(String ownerName)
		{
			this.ownerName = ownerName;
		}
		public void setCertificateName(String certificateName)
		{
			this.certificateName = certificateName;
		}
		public void setCertificateNo(String certificateNo)
		{
			this.certificateNo = certificateNo;
		}
		public void setTelephone(String telephone)
		{
			this.telephone = telephone;
		}
		public void setOrganization(boolean isOrganization)
		{
			this.isOrganization = isOrganization;
		}
		public boolean isOrganization()
		{
			return isOrganization;
		}

		public String getOrgName()
		{
			return orgName == null ?"":orgName;
		}

		public String getOrgAddress()
		{
			return orgAddress == null ?"":orgAddress;
		}

		public String getOrgContactPerson()
		{
			return orgContactPerson == null ?"":orgContactPerson;
		}

		public String getOrgTelephone()
		{
			return orgTelephone == null ?"":orgTelephone;
		}

		public String getOrgZipcode()
		{
			return orgZipcode == null ?"":orgZipcode;
		}

		public void setOrgName(String orgName)
		{
			this.orgName = orgName;
		}

		public void setOrgAddress(String orgAddress)
		{
			this.orgAddress = orgAddress;
		}

		public void setOrgContactPerson(String orgContactPerson)
		{
			this.orgContactPerson = orgContactPerson;
		}

		public void setOrgTelephone(String orgTelephone)
		{
			this.orgTelephone = orgTelephone;
		}

		public void setOrgZipcode(String orgZipcode)
		{
			this.orgZipcode = orgZipcode;
		}


	}